package leecode

func hIndex2(citations []int) int {
	n := len(citations)
	h := 0
	for i := n - 1; i >= 0; i-- {
		if citations[i] >= n-i {
			h = n - i
		} else {
			break
		}
	}
	return h
}
